<?php

namespace App\Http\Controllers;

use App\Http\Model\Api\AccompanyUser;
use App\Http\Model\Api\FinanceCharmStream;
use App\Http\Model\Api\FinanceRechargeOrder;
use App\Http\Model\Api\FinanceRoomWealthStream;
use App\Http\Model\Api\FinanceWalletStream;
use App\Http\Model\Config;
use App\Http\Model\OutJson;
use App\Http\Model\TopupRebateRecharge;
use App\Http\Model\User;
use App\Http\Services\ConfigServices;
use App\Http\Services\ShareDiamondServices;
use App\Http\Services\ShareSendGoodsServices;
use App\Http\Services\UserServices;
use Laravel\Lumen\Routing\Controller as BaseController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redis;

/*
 * 充值赠送钻石
 * */

class SpringController extends BaseController
{
    protected $wealth_model;
    protected $charm_model;
    protected $room_model;


    public function __construct(FinanceWalletStream $financeWalletStream,  FinanceCharmStream $financeCharmStream, FinanceRoomWealthStream $financeRoomWealthStream)
    {
        $this->wealth_model = $financeWalletStream;
        $this->charm_model = $financeCharmStream;
        $this->room_model = $financeRoomWealthStream;
    }

    public function ranking(Request $request, Config $config) {
      // $type = (int) $request->get('type');

      $config = $config->getShareGoodsConfig(17);
      $config = array_values($config);
      $config =  explode(" - ", $config[0]['value']);

      // $lists = [];
      // if($type === 1){
      //   $lists = $this->charm_model->userRanking($config[0], $config[1]);
      // } elseif($type === 2) {
      //   $lists = $this->wealth_model->userRanking($config[0], $config[1]);
      // } elseif ($type === 3) {
      //   $lists = $this->room_model->userRanking($config[0], $config[1]);
      // }

      $active_date = date("Y年m月d日", strtotime($config[0])) . "至" . date("d日", strtotime($config[1]));
      OutJson::toJson(200, '成功', ['date' => $active_date]);
    }
}
